<?php 
if (isset($_POST['btnSent'])) {
	$str = strtolower($_POST['capcha']);
	if ($_SESSION['captcha_code'] != $str) {
		$error="<font color='#FF0000'><i>Nhập sai mã số.</i></font>"; // xử lý lỗi
	}
	else {
		/*include_once('smtp.php');
		$body = "<h3>Welcome, website management.</h3></br><strong>".$_POST['FullName']."</strong>&nbsp;Leave a message after:"."<br><br>".$_POST['Comment']."<br>"."<br>"."<br>Email: ".$_POST['Email']."<br>Address: ".$_POST['Address']."<br>Telephone: ".$_POST['Tel'];
		SendMail('admin@netspace.edu.vn','sweetcharcoal@yahoo.com',$_POST['Title'],$body,'No-replay | Tala charcoal');*/
	}
}

$view_post .= "
<div id='navigator'><a href='/'>Trang chủ</a><a href='lien-he/'><font color='#63A52A'>Liên hệ</font></a></div>
<div style='width:400px; float:left; line-height:22px; margin-left:30px'>".$row_config['contact']."<br /><img src='images/map_contact.jpg' alt='Map Liên Hệ' /></div>
	<script language='javascript'>
		function KiemTra() {
			myFrmObj = document.comment
			
			if(myFrmObj.FullName.value == '') {
				window.alert('Please enter a valid name.');
				myFrmObj.FullName.focus('FullName');
				return false;
			}
			else if(myFrmObj.Email.value == '') {
				window.alert('Please enter an email address.');
				myFrmObj.Email.focus('Email');
				return false;
			}
			else if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myFrmObj.Email.value))){
				window.alert('Please enter a valid email address.');
				myFrmObj.Email.focus('Email');
				return false;
			}
			else if(myFrmObj.Comment.value == '') {
				window.alert('Please write your comments here.');
				myFrmObj.Comment.focus('Comment');
				return false;
			}
			return true;
		}
	</script>
	<div style='width:420; float:right; margin-right:75px'>
    <form action='' method='post' name='comment' onSubmit='return KiemTra()'>
    <table width='420' align='center' border='0' cellspacing='5' cellpadding='5'>
      <tr><td colspan='2' style='font-weight:bold; font-size:16px'>Form liên hệ:<br /><br /></td></tr>
	  <tr>
        <td width='90'>Họ và tên:</td>
        <td><input type='text' name='FullName' value='{$_POST['FullName']}' maxlength='50' class='txt' /></td>
      </tr>
      <tr>
        <td>Email:</td>
        <td><input type='text' name='Email' value='{$_POST['Email']}' maxlength='50' class='txt' /></td>
      </tr>
      <tr>
        <td>Địa chỉ:</td>
        <td><input type='text' name='Address' value='{$_POST['Address']}' maxlength='250' class='txt' /></td>
      </tr>
      <tr>
        <td>Điện thoại:</td>
        <td><input type='text' name='Tel' value='{$_POST['Tel']}' maxlength='50' class='txt' /></td>
      </tr>
      <tr>
        <td valign='top'>Nội dung:</td>
        <td><textarea name='Comment' class='textarea'>{$_POST['Comment']}</textarea></td>
      </tr>
        <!--<tr>
          <td align='right' valign='top'>Codes verify:<span style='color:#FF0000'> *</span></td>
          <td><input name='capcha' type='text' id='capcha' class='txt' maxlength='5' value='{$_POST['capcha']}' />
              <br /><img src='capcha/capcha_image.php' /><br />{$error}</td>
        </tr>-->
      <tr>
        <td>&nbsp;</td>
        <td><input type='submit' name='btnSent' value='GỬI ĐI' class='btn' /></td>
      </tr>
    </table>
  </form></div><div style='clear:both; height:80px'></div>";